package demo1221.pm;

import java.util.Objects;

public class Student {
    private String stuId;
    private String name;

    public Student(String stuId, String name) {
        this.stuId = stuId;
        this.name = name;
    }

    public Student() {
    }

    public String getStuId() {
        return stuId;
    }

    public void setStuId(String stuId) {
        this.stuId = stuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(stuId, student.stuId) &&
                Objects.equals(name, student.name);
    }

    @Override
    public int hashCode() {
        System.out.println("执行了...");
        return Objects.hash(stuId, name);
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuId='" + stuId + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
